package com.test.controller;

import com.test.po.Products;
import com.test.service.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
//@SessionAttributes({"products"})
@SessionAttributes("username")
@Controller
public class DetailProductController {
    @Autowired
    private ProductsService productsService;

    @RequestMapping("/detail.do")
    public String details(Integer id , ModelMap map){

        Products products = productsService.selectByPrimaryKey(id);

        map.addAttribute("products",products);

        return "productdetail";
    }



}
